﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _04_Poker
{
    class Program
    {
        static void Main(string[] args)
        {
            //string[] cards = new string[5];
            string currentCard;
            Dictionary<string, int> bestHand = new Dictionary<string, int>();
            for (int i = 0; i < 5; i++)
            {
                currentCard = Console.ReadLine();
                if (bestHand.ContainsKey(currentCard))
                {
                    bestHand[currentCard]++;
                }
                else
                {
                    bestHand.Add(currentCard, 1);
                }
            }
            if (bestHand.Count==5)
            {
                if (checkConsecutive(bestHand))//check consecutive
                {
                    Console.WriteLine("Straight");
                }
                else
                {
                    Console.WriteLine("Nothing");
                }
            }
            else if (bestHand.Count==4)
            {
                Console.WriteLine("One Pair");
            }
            else if (bestHand.Count==3)
            {
                if (bestHand.ContainsValue(3))
                {
                    Console.WriteLine("Three of a Kind");
                }
                else
                {
                    Console.WriteLine("Two Pairs");
                }
            }
            else if (bestHand.Count==2)
            {
                if (bestHand.ContainsValue(4))
                {
                    Console.WriteLine("Four of a Kind");
                }
                else
                {
                    Console.WriteLine("Full House");
                }
            }
            else
            {
                Console.WriteLine("Impossible");
            }
        }

        private static bool checkConsecutive(Dictionary<string, int> bestHand)
        {
            string next,previous;
            foreach (var item in bestHand)
            {
                next = calcNext(item.Key);
                previous = calcPrev(item.Key);
                if ((!(bestHand.ContainsKey(next)||bestHand.ContainsKey(previous)))||(bestHand.ContainsKey("2")&&bestHand.ContainsKey("K")))
                {
                    return false;
                }
            }
            return true;
        }

        private static string calcPrev(string p)
        {
            switch (p)
            {
                case "A": return "K";
                case "K": return "Q";
                case "Q": return "J";
                case "J": return "10";
                case "10": return "9";
                case "9": return "8";
                case "8": return "7";
                case "7": return "6";
                case "6": return "5";
                case "5": return "4";
                case "4": return "3";
                case "3": return "2";
                case "2": return "A";
                default:  return "-1";
            }
        }

        private static string calcNext(string p)
        {
            switch (p)
            {
                case "A": return "2";
                case "2": return "3";
                case "3": return "4";
                case "4": return "5";
                case "5": return "6";
                case "6": return "7";
                case "7": return "8";
                case "8": return "9";
                case "9": return "10";
                case "10": return "J";
                case "J": return "Q";
                case "Q": return "K";
                case "K": return "A";
                default: return "-1";

            }
        }
    }
}
